from web import models


def operate_log(func):
    def inner(*args, **kwargs):
        result = func(*args, **kwargs)
        request = args[1]
        current_user_id = request.session['user_info']['user_id']
        current_user_obj = models.UserInfo.objects.filter(pk=current_user_id).first()
        models.UserOperate.objects.create(operate_person=current_user_obj.nickname, action='增加')
        print(current_user_obj.nickname)
        return result

    return inner
